package com.bgy.common.base;

import com.bgy.common.enums.CodeMsg;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

/**
 * @description: 事件传输数据(websocket传输数据)
 * @author: yujie
 * @date 2019/5/17 14:01
 */
@Data
@ApiModel(description = "返回响应体,不带data数据")
public class ApiEventResult<T> {
    @ApiModelProperty(value = "响应代码")
    private String code;
    @ApiModelProperty(value = "事件类型")
    private String event;
    @ApiModelProperty(value = "描述")
    private String message;
    @ApiModelProperty(value = "传输数据")
    private T   data;

    public ApiEventResult(String code, String message, String event,T data) {
        this.code = code;
        this.message = message;
        this.event = event;
        this.data = data;
    }

    public ApiEventResult(CodeMsg codeMsg, String event,T data) {
        this.code = codeMsg.getCode();
        this.message = codeMsg.getMsg();
        this.event = event;
        this.data = data;

    }
}
